package com.example.oa.util;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.commons.codec.binary.Hex;

/**
 *SHA1加密
 * @author 龙海成
 *
 */
public class Encryption {
	public static String getEncryption(String msg) {
		String digestmsg = "";
		try {
			MessageDigest md = MessageDigest.getInstance("MD5");
			byte[] a = md.digest(msg.getBytes());
			digestmsg = Hex.encodeHexString(a);
		} catch (NoSuchAlgorithmException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return digestmsg;
	}
}
